#include <QGraphicsTextItem>

#include <UIKit/UIApplication.h>
#include <UIKit/UIWindow.h>
#include <UIKit/UIDevice.h>
#include <UIKit/UIFont.h>

#include "MainViewController.h"

MainViewController::MainViewController (QObject *parent)
    : UIViewController(parent)
{
    UIDevice *device = UIDevice::currentDevice();
    device->beginGeneratingDeviceOrientationNotifications();
}

MainViewController::~MainViewController() {
}

void MainViewController::viewDidLoad (void) {
    UIWindow *window = new UIWindow;
    UIApplication::sharedApplication()->setKeyWindow(window);

    QGraphicsTextItem *textItem = window->addText(tr("Hello World"));
    textItem->setDefaultTextColor(Qt::white);
    textItem->setFont(UIFontNormalBold(textItem->font()));

    orientationChanged();
}

void MainViewController::viewDidUnload (void) {
}

void MainViewController::orientationChanged (void) {
    // TODO Handle Rotation
}

bool MainViewController::shouldAutorotate (UIInterfaceOrientation orientation) const {
    Q_UNUSED(orientation)
    return(true);
}


